#ifndef __NETCLIENT_H__
#define __NETCLIENT_H__

#pragma once

#include "nl.h"
#include "NetBase.h"

class COgreEngine;

class CNetClient : public CNetBase
{
public:
	CNetClient(COgreEngine *pEngine, char const * const pAddress, int const pPort = SERVER_PORT);
	virtual ~CNetClient(void);

	void Create(void);
	void Destroy(void);

#ifdef __USE_HAWKTHREAD__
	static void * MainClientLoop(void * pClient);
#endif
#ifdef __USE_WIN32THREAD__
	static DWORD WINAPI MainClientLoop( LPVOID pClient );
#endif

	void TryConnect(void);
	bool frameStarted(const FrameEvent& evt);

	void SetAddress(char const * const pAddress = NULL, int const pPort = SERVER_PORT);

public:
	NLaddress m_Address;
	//void WaitUntilReady(void);
	bool m_IsAddressSet;

	String m_AddressString;
	bool m_IsServerReady;

	static CNetClient * ms_pSingleton;

	SShared m_LastPacket;
};

#endif //__NETCLIENT_H__
